<template>
  <div class="body">
    <div class="main">
      <h1>{{name}}</h1>
      <h1>欢迎登录</h1>
      <br />
      <el-input v-model="userInfo.username" placeholder="请输入用户名"></el-input>
      <br />
      <el-input placeholder="请输入密码" v-model="userInfo.password" show-password></el-input>
      <br />
      <el-button type="primary" @click="login">登录</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "login",
  data() {
    return {
      name: process.env.VUE_APP_NAME,
      userInfo: {
        username: "",
        password: ""
      }
    };
  },

  mounted() {
    // console.log(this.$store.state.login);
  },
  methods: {
    // 登录
    login() {
      let params = {
        username:this.userInfo.username,
        password:this.userInfo.password,
      };
      this.$store.dispatch("actChangeName", params).then(res => {

      });
    }
  }
};
</script>

<style  scoped>
.main {
  width: 40%;
  border-radius: 20px;
  margin: auto;
  background-color: rgba(255, 255, 255, 0.3);
  padding: 20px 100px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  /* margin-top: 13%; */
}
.body {
  width: 100%;
  height: 100vh;
  background-image: url("../assets/login.png");
  opacity: 0.8;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  /* overflow: hidden; */
  padding-top: 10%;
}
</style>
